import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  // 2小时失效时间
  let seconds = 10 * 1000 * 6 * 60 * 2
  let expires = new Date(new Date() * 1 + seconds)
  return Cookies.set(TokenKey, token, { expires: expires })
  // 正常保存
  // return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}
